from django.shortcuts import render, redirect
from django.views import View
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator


@method_decorator(login_required, name='dispatch')
class MessageView(View):
    """
    用户中心首页
    """

    def get(self, request, *args, **kwargs):
        return render(request, 'message.html')


def error404(request):
    """
    400错误页面
    :param request:
    :return:
    """
    response = render(request, '404.html')
    response.status_code = 404
    return response


def error500(request):
    """
    500错误页面
    :param request:
    :return:
    """
    response = render(request, '500.html')
    response.status_code = 500
    return response
